package demo5;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2024-06-18
 * Time: 18:11
 */
class OutClass {

    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;


    class InnerClass {
        public int data1 = 1000;
        public int data4 = 4;
        public static int data5 = 5;

        public void test() {
            OutClass outClass = new OutClass();
            System.out.println(outClass.data1);
            System.out.println(OutClass.this.data1);
            System.out.println(this.data1);
            System.out.println(data1);
            System.out.println(data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);

        }
    }


    interface IA{
        void test1();
    }
public class Test{
    public static void main(String[] args) {
        //这个类 实现了 IA 接口，并且重写了test1这个方法
        IA ia = new IA() {
            @Override
            public void test1() {

            }
        };

    }
}

   /* class Out{
        public void test1(){
            System.out.println("test1()");
        }

    }
    public class Test {


        public static void main(String[] args) {
            new Out(){

            }.test1();
        }*/
        public void testMethod() {
            class Inner {
                public int data1;

                public void func() {
                    System.out.println("func");
                }
            }

            Inner inner = new Inner();
            inner.func();
        }



        public static void main6(String[] args) {
            //如何实例化一个实例内部类对象
            OutClass outClass = new OutClass();

            OutClass.InnerClass innerClass = outClass.new InnerClass();
            innerClass.test();
        }
    }

